#Here we document the construction of the time series plots used in the Online Appendix.

setwd(dirname(rstudioapi::getActiveDocumentContext()$path))

#Load Twitter and Facebook data. These data sets cannot be shared publicly.
load("MPs FB Twitter/MP_fbposts.Rda")
load("MPs FB Twitter/MP_tweets.Rda")

#Facebook
fb_byday <- fb %>% 
  group_by(date) %>% 
  summarise(n = n()) %>% 
  ggplot(aes(x = date, y = n)) +
  geom_point() +
  geom_smooth() +
  labs(x = "Day", y = "Facebook posts") +
  theme_bw() 
save(fb_byday, file = "fb_byday.Rda")

#Twitter
tw_byday <- tweets %>% 
  group_by(date) %>% 
  summarise(n = n()) %>% 
  ggplot(aes(x = date, y = n)) +
  geom_point() +
  geom_smooth() +
  labs(x = "Day", y = "Tweets") +
  theme_bw()
save(tw_byday, file = "tw_byday.Rda")

